package com.vn.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import javax.persistence.GeneratedValue;

@Entity
@Table(name="ChargeRegisterPayment")
public class ChargeRegisterPayment implements Serializable{
	
	public ChargeRegisterPayment() {
		super();
	}
	
	public ChargeRegisterPayment(
			ChargeRegisterPaymentPK chargeRegisterPaymentPK,
			PurchaseContract purchaseContract, ChargeRegister chargeRegister,
			Date datePayment) {
		super();
		this.chargeRegisterPaymentPK = chargeRegisterPaymentPK;
		this.purchaseContract = purchaseContract;
		this.chargeRegister = chargeRegister;
		this.datePayment = datePayment;
	}



	@EmbeddedId
    protected ChargeRegisterPaymentPK chargeRegisterPaymentPK;
	
	@Column(name="DatePayment")
	private Date datePayment;
	
	@JoinColumn(name="ContractID",referencedColumnName="IDContract", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
	private PurchaseContract purchaseContract;
	
	@JoinColumn(name="ChargeID",referencedColumnName="IDCharge", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
	private ChargeRegister chargeRegister;

	public ChargeRegisterPaymentPK getChargeRegisterPaymentPK() {
		return chargeRegisterPaymentPK;
	}

	public void setChargeRegisterPaymentPK(
			ChargeRegisterPaymentPK chargeRegisterPaymentPK) {
		this.chargeRegisterPaymentPK = chargeRegisterPaymentPK;
	}

	public Date getDatePayment() {
		return datePayment;
	}

	public void setDatePayment(Date datePayment) {
		this.datePayment = datePayment;
	}

	public PurchaseContract getPurchaseContract() {
		return purchaseContract;
	}

	public void setPurchaseContract(PurchaseContract purchaseContract) {
		this.purchaseContract = purchaseContract;
	}

	public ChargeRegister getChargeRegister() {
		return chargeRegister;
	}

	public void setChargeRegister(ChargeRegister chargeRegister) {
		this.chargeRegister = chargeRegister;
	}
	
}
